<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>Dev Example — Networked-Aframe</title>
    <meta name="description" content="Dev Example — Networked-Aframe" />

    <script src="https://aframe.io/releases/1.7.0/aframe.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.8.1/socket.io.min.js"></script>
    <script src="/easyrtc/easyrtc.js"></script>
    <script src="/dist/networked-aframe.js"></script>

    <script src="https://cdn.jsdelivr.net/npm/aframe-randomizer-components@3.0.2/dist/aframe-randomizer-components.min.js"></script>
    <script src="/js/spawn-in-circle.component.js"></script>

    <script>
      function onConnect() {
        setTimeout(sendEvents, 3000);
      }

      function sendEvents() {
        NAF.connection.broadcastDataGuaranteed('reliableBroadcast', '');
        NAF.connection.broadcastData('unreliableBroadcast', '');

        var clients = NAF.connection.getConnectedClients();

        var firstClient;
        for (firstClient in clients) break;

        console.error(clients);
        console.error(firstClient);

        NAF.connection.sendDataGuaranteed(firstClient, 'reliableSend', '');
        NAF.connection.sendData(firstClient, 'unreliableSend', '');
      }
    </script>
  </head>
  <body>
    <div>
      <p>Sender. Open first receiver to test.</p>
    </div>

    <!-- Uncomment the block corresponding to the network adapter you want to test -->

    <a-scene
      embedded
      networked-scene="
      room: dev;
      debug: true;
      adapter: wseasyrtc;
    "
    >
      <!-- <a-scene embedded networked-scene="
      room: dev;
      debug: true;
      adapter: easyrtc;
    "> -->
    </a-scene>
  </body>
</html>
